/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "tradeset_pip")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TradesetPip.findAll", query = "SELECT t FROM TradesetPip t"),
    @NamedQuery(name = "TradesetPip.findByPipID", query = "SELECT t FROM TradesetPip t WHERE t.pipID = :pipID"),
    @NamedQuery(name = "TradesetPip.findByPipName", query = "SELECT t FROM TradesetPip t WHERE t.pipName = :pipName"),
    @NamedQuery(name = "TradesetPip.findByType", query = "SELECT t FROM TradesetPip t WHERE t.type = :type"),
    @NamedQuery(name = "TradesetPip.findByRegionID", query = "SELECT t FROM TradesetPip t WHERE t.regionID = :regionID"),
    @NamedQuery(name = "TradesetPip.findByMarketCode", query = "SELECT t FROM TradesetPip t WHERE t.marketCode = :marketCode"),
    @NamedQuery(name = "TradesetPip.findByClassCode", query = "SELECT t FROM TradesetPip t WHERE t.classCode = :classCode"),
    @NamedQuery(name = "TradesetPip.findByBrokerID", query = "SELECT t FROM TradesetPip t WHERE t.brokerID = :brokerID"),
    @NamedQuery(name = "TradesetPip.findByLimitA", query = "SELECT t FROM TradesetPip t WHERE t.limitA = :limitA"),
    @NamedQuery(name = "TradesetPip.findByLimitB", query = "SELECT t FROM TradesetPip t WHERE t.limitB = :limitB"),
    @NamedQuery(name = "TradesetPip.findByLimitC", query = "SELECT t FROM TradesetPip t WHERE t.limitC = :limitC"),
    @NamedQuery(name = "TradesetPip.findByOwnUserID", query = "SELECT t FROM TradesetPip t WHERE t.ownUserID = :ownUserID"),
    @NamedQuery(name = "TradesetPip.findByAlterUserID", query = "SELECT t FROM TradesetPip t WHERE t.alterUserID = :alterUserID"),
    @NamedQuery(name = "TradesetPip.findByCreateTime", query = "SELECT t FROM TradesetPip t WHERE t.createTime = :createTime"),
    @NamedQuery(name = "TradesetPip.findByTimeStamp", query = "SELECT t FROM TradesetPip t WHERE t.timeStamp = :timeStamp")})
public class TradesetPip implements Serializable {
	public static byte[] EnCode(TradesetPip msg) throws IOException {
		Codec<TradesetPip> Lcode = ProtobufProxy.create(TradesetPip.class);
		return Lcode.encode(msg);
	}
	public static TradesetPip DeCode(byte[] data) throws IOException {
	Codec<TradesetPip> Lcode = ProtobufProxy.create(TradesetPip.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PipID")
    @Protobuf
	private Integer pipID;
    @Column(name = "PipName")
    private String pipName;
	@Protobuf
	private byte[] pipNameBit;
    @Column(name = "Type")
    @Protobuf
	private String type;
    @Column(name = "RegionID")
    @Protobuf
	private String regionID;
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Column(name = "BrokerID")
    @Protobuf
	private String brokerID;
    @Column(name = "LimitA")
    @Protobuf
	private Integer limitA;
    @Column(name = "LimitB")
    @Protobuf
	private Integer limitB;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "LimitC")
    @Protobuf
	private Float limitC;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public TradesetPip() {
    }

    public TradesetPip(Integer pipID) {
        this.pipID = pipID;
    }

    public Integer getPipID() {
        return pipID;
    }

    public void setPipID(Integer pipID) {
        this.pipID = pipID;
    }

    public String getPipName() {
        return pipName;
    }

    public void setPipName(String pipName) {
        this.pipName = pipName;
        this.setPipNameBit(CodeTool.StringToBit(pipName));
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getRegionID() {
        return regionID;
    }

    public void setRegionID(String regionID) {
        this.regionID = regionID;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public String getBrokerID() {
        return brokerID;
    }

    public void setBrokerID(String brokerID) {
        this.brokerID = brokerID;
    }

    public Integer getLimitA() {
        return limitA;
    }

    public void setLimitA(Integer limitA) {
        this.limitA = limitA;
    }

    public Integer getLimitB() {
        return limitB;
    }

    public void setLimitB(Integer limitB) {
        this.limitB = limitB;
    }

    public Float getLimitC() {
        return limitC;
    }

    public void setLimitC(Float limitC) {
        this.limitC = limitC;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pipID != null ? pipID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TradesetPip)) {
            return false;
        }
        TradesetPip other = (TradesetPip) object;
        if ((this.pipID == null && other.pipID != null) || (this.pipID != null && !this.pipID.equals(other.pipID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.TradesetPip[ pipID=" + pipID + " ]";
    }

    public byte[] getPipNameBit() {
        return pipNameBit;
    }

    public void setPipNameBit(byte[] pipNameBit) {
        this.pipNameBit = pipNameBit;
		this.pipName = CodeTool.BitToString(pipNameBit);
    }
    
}
